<?php
	$items = $self->getCollection();
?>
<div class="content-header row-fluid">
	<h3 class="pull-left"><?php echo $self->getTitle() ?></h3>
	<div class="actions pull-right">
		<a href="<?php echo App::url('admin/category/reindex') ?>" class="btn btn-success">Re-index</a>
		<a href="<?php echo $self->getNewUrl() ?>" class="btn">Add</a>
	</div>
</div>

<table class="table table-bordered table-hover">
	<colgroup>
		<col/>
		<col width="150"/>
	</colgroup>

	<thead>
		<tr>
			<th>Name</th>
			<th>Post count</th>
		</tr>
	</thead>
	
	<tbody>
		<?php foreach($items as $item): ?>
		<tr title="<?php echo $self->getRowUrl($item->getId()) ?>">
			<td>
			<?php
				for($i=0; $i < $item->getLevel(); $i++) echo '&nbsp;&nbsp;&nbsp;&nbsp;';
				echo $item->getName();
			?>
			</td>
			<td><?php echo $item->getPostCount() ?></td>
		</tr>
		<?php endforeach ?>
	</tbody>
</table>

<script type="text/javascript">
//<![CDATA[
initGrid();
//]]>
</script>
